#!/usr/bin/env python

class Gauge(object):
    '''Gauge class
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, March 22, 2012. 07:34 PM'''
    
    total = 1
    value = 0
    _percent = 0
    
    def __init__(self, total):
        self.total = total if total else 1
    
    def inc(self):
        self.value += 1
        percent = self.percent
        if self._percent != percent:
            self._percent = percent
            return True
        else:
            return False
    
    @property
    def humanValue(self):
        return format(self.value, ',d')
    
    @property
    def humanTotal(self):
        return format(self.total, ',d')
    
    @property
    def percent(self):
        return int((self.value / (self.total * 1.0)) * 100)
    
    @property
    def humanPercent(self):
        return '%d%%' % self.percent
    